#include <57header.h>

// 客户端
int main(int argc,char*argv[])
{
    char *port = "8080";
    char *ip = "192.168.106.129";

    int socket_fd = socket(AF_INET, SOCK_DGRAM,  0);


    struct sockaddr_in sockaddr;
    sockaddr.sin_family = AF_INET;
    sockaddr.sin_port = htons(atoi(port));
    sockaddr.sin_addr.s_addr = inet_addr(ip);

    sendto(
           socket_fd,
           "hello",
           5,
           0,
            (struct sockaddr *)&sockaddr,
            sizeof(sockaddr)
          );

    socklen_t len = sizeof(sockaddr);
    char buf[60] = {0};
    recvfrom(socket_fd, buf, sizeof(buf), 0,
             (struct sockaddr *)&sockaddr, 
             &len);

    printf("buf: %s \n", buf);

    close(socket_fd);
    return 0;
}

